package com.data.ferry.web;

import com.data.ferry.common.config.ConstantConfig;
import com.data.ferry.common.result.ResponseResult;
import com.data.ferry.common.result.ResultUtil;
import com.data.ferry.entity.UserInfo;
import com.data.ferry.service.UserInfoService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 查询用户
 * userinfo
 */
@Api("用户管理")
@RestController
@RequestMapping("userinfo")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;


    @GetMapping("findList")
    public ResponseResult findList(){
        List<UserInfo> list = userInfoService.findList();
        return  ResultUtil.success(list,list.size());
    }

    @PostMapping("addUser")
    public int addUser(UserInfo userInfo){
        return  userInfoService.addUser(userInfo);
    }
}
